import { Fragment } from '@/components/Fragment';
import { Image, View } from '@aws-amplify/ui-react';
import { Example, ExampleCode } from '@/components/Example';
import { ComponentStyleDisplay } from '@/components/ComponentStyleDisplay';
import { ImageDemo } from './demo';
import {
DefaultImageExample,
ImageObjectFitAndPositionExample,
ImageOptimizationExample,
} from './examples';
## Demo
## Usage
Import the `Image` component. Images are responsive by default (if you're on desktop, try resizing your browser window).
```jsx file=./examples/DefaultImageExample.tsx
```
### Responsive Image optimization
Use `sizes` and `srcSet` to dynamically load different Image sizes based on screen size/resolution. For more information, see [MDN responsive images article](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images).
```jsx file=./examples/ImageOptimizationExample.tsx
```
### Object fit and object position
To control how an Image fits its container, use the `objectFit` and `objectPosition` properties.
```jsx file=./examples/ImageObjectFitAndPositionExample.tsx
```
## CSS Styling
### Target classes